<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'employee.label', default: 'Employee')}"/>
    <title>公司</title>
</head>

<body>
<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>员工</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">员工</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
            <!-- Hover table card start -->
            <div class="card">
                <div class="card-header">
                    <h5>员工</h5>

                    <div class="card-header-right">
                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block dt-responsive">

                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                            <g:form method="POST" action="searchOpportunity">
                                <div class="row m-0">
                                    <div class="col-md-8 p-l-0">
                                        <div id="order-table_filter" class="dataTables_filter text-left">
                                            <label>搜索<input type="text" class="form-control" placeholder="姓名"
                                                            name="fullName"
                                                            id="fullName"
                                                            value="${params?.fullName}">
                                                        <input type="text" class="form-control" placeholder="手机"
                                                            name="cellphone"
                                                            id="cellphone"
                                                            value="${params?.cellphone}">
                                                        <input type="text" class="form-control" placeholder="部门"
                                                            name="department"
                                                            id="department"
                                                            value="${params?.department}">
                                                        <input type="text" class="form-control" placeholder="职位"
                                                            name="position"
                                                            id="position"
                                                            value="${params?.position}">
                                            </label>
                                        </div>
                                    </div>
                                    <div class="col-md-4 p-r-0 dt-buttons text-right">
                                        <button class="btn btn-success btn-mini" type="submit"><i
                                                class="icofont icofont-search"></i>搜索
                                        </button>
                                        <button class="btn btn-warning btn-mini" type="button"
                                                id="resetBtn"><i
                                                class="icofont icofont-close"></i>重置</button>
                                        <g:link action="create" class="btn btn-info btn-mini">
                                            <i class="icofont icofont-plus"></i>新增
                                        </g:link>

                                    </div>
                                </div>
                            </g:form>

                    <table class="table table-striped  table-bordered table-hover">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name"
                                              title="${message(code: 'employee.fullName.label', default: '姓名')}"/>
                            <g:sortableColumn property="telephone"
                                              title="${message(code: 'employee.cellphone.label', default: '部门')}"/>
                            <g:sortableColumn property="telephone"
                                              title="${message(code: 'employee.department.label', default: '岗位')}"/>
                            <g:sortableColumn property="telephone"
                                              title="${message(code: 'employee.position.label', default: '开始时间')}"/>
                            <g:sortableColumn property="telephone"
                                              title="${message(code: 'employee.position.label', default: '截止时间')}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${employeeList}">
                            <tr>
                                <td><g:link controller="employee" action="show" id="${it?.id}">${it.fullName}</g:link></td>
                                <td>${com.next.EmployeePosition.findByEmployeeAndIsPrimary(it, true)?.position?.department?.name}</td>
                                <td>${com.next.EmployeePosition.findByEmployeeAndIsPrimary(it, true)?.position?.name}</td>
                                <td>${com.next.EmployeePosition.findByEmployeeAndIsPrimary(it, true)?.startTime}</td>
                                <td>${com.next.EmployeePosition.findByEmployeeAndIsPrimary(it, true)?.endTime}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>

                            <div class="dataTables_paginate">
                                <div class="pagination">
                                    <g:paginate total="${employeeCount ?: 0}" params="${params}"/>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
            <!-- Hover table card end -->
        </div>

        <!-- Page-body end -->
    </div>
</div>
<g:javascript>
    $(function(){
        $("#resetBtn").click(function () {
            $("#fullName").val("");
            $("#cellphone").val("");
            $("#department").val("");
            $("#posation").val("");
        })
    });

</g:javascript>
</body>
</html>